<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <link rel="stylesheet" href="__PUBLIC__/js/bootstrapvalidator/css/bootstrapValidator.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/js/jquery-upload/css/jquery.fileupload.css" />
    <link rel="stylesheet" href="__PUBLIC__/js/jquery-upload/css/jquery.fileupload-ui.css" />
    <script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/vendor/jquery.ui.widget.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload-ui.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.iframe-transport.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload-process.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
</head>
<body>
<div class="modal-dialog" role="document">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="exampleModalLabel">独立工作区详情</h4>
        </div>
        <form class="form-horizontal" style="padding:4%;height:450px;overflow-y:auto;" id="officeRoomForm">
            <input type="hidden" name="token" value="{$formToken}">
            <input type="hidden" name="id" value="{$id}"/>
            <div class="form-group">
                <label class="control-label col-sm-3">所属空间:</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" name="space_id" value="{$office.space.name}" placeholder="">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-3">工作区编号:</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" name="room_no" value="{$office.room_no}" placeholder="请输入工作区编号">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-3">空间面积:</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input type="text" class="form-control" name="area" value="{$office.area}" placeholder="请输入空间面积">
                        <div class="input-group-addon">M&sup2;</div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-3">整租价格:</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input type="text" class="form-control" name="rent_price" value="{$office.rent_price}" placeholder="请输入整租价格">
                        <div class="input-group-addon">元/月</div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-3">工位单价:</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input type="text" class="form-control" name="unit_price" value="{$office.unit_price}" placeholder="请输入工位单价">
                        <div class="input-group-addon">元/月</div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-3">是否启用:</label>
                <div class="col-sm-8">
                    <input type="checkbox" name="_status" value="{$office.status|default="1"}" />
                    <input type="hidden" name="status" value="{$office.status|default="1"}" />
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-3">备注:</label>
                <div class="col-sm-8">
                    <textarea rows="4" class="form-control" name="remark" placeholder="">{$office.remark}</textarea>
                </div>
            </div>
        </form>
        <div class="modal-footer">
            <button type="button" data-dismiss="modal" class="btn btn-default">取消</button>
        </div>
    </div>
</div>

<script type="text/javascript">
    var webRoot = "__ROOT__";
    $(function(){
        initSwitchOption("_status","是","否","{$office.status|default="1"}");
    });

    function initSwitchOption(name,onText,offText,state) {
        var switchOption = {
            onText: onText,
            offText: offText,
            onColor: "success",
            offColor: "info",
            state: state == 1 ? true : false,
            onSwitchChange: function (event, state) {
                if (state == true) {
                    $(this).val("1");
                } else {
                    console.log(state);
                    $(this).val("0");
                }
                var value = $(this).val();
                $("input:hidden[name='"+name.substring(1)+"']").val(value);
            }
        };
        $("input:checkbox[name='"+name+"']").bootstrapSwitch(switchOption);
    }
</script>
</body>
</html>